package com.test.action.login;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jeecg.study.action.ActionNew;
import com.jeecg.study.common.utils.Global;
import com.jeecg.study.entity.MessageVo;
import com.jeecg.study.form.ActionForm;
import com.test.form.login.UserForm;

public class LoginAction implements ActionNew {

	@Override
	public String execute(HttpServletRequest request, HttpServletResponse arg1, ActionForm arg2,
			Map<String, String> arg3) {
		
		UserForm userForm=(UserForm)arg2;
		MessageVo messageVo =new MessageVo();
		messageVo.setUserName(userForm.getUserName());
		if("admin".equals(userForm.getUserName()) && "123".equals(userForm.getPassword())){
			messageVo.setResult("登录成功!");
			request.setAttribute("messageVo", messageVo);
			return arg3.get(Global.RESULT_SUCCESS);
		}
		messageVo.setResult("登录失败!");
		request.setAttribute("messageVo", messageVo);
		return arg3.get(Global.RESULT_FAIL);
	}

}
